import request from '@/config/axios'

// 表单构建 VO
export interface FormConstructVO {
  // 主键id
  id: number
  // 表单名称
  formName: string
  // 表单编码
  formCode: string
  // 表单结构
  formSchema: string
}

// 表单构建 API
export const FormConstructApi = {
  // 查询表单构建分页
  getFormConstructPage: async (params: any) => {
    return await request.get({ url: `/infra/form-construct/page`, params })
  },

  // 查询表单构建详情
  getFormConstruct: async (id: number) => {
    return await request.get({ url: `/infra/form-construct/get?id=` + id })
  },

  // 新增表单构建
  createFormConstruct: async (data: FormConstructVO) => {
    return await request.post({ url: `/infra/form-construct/create`, data })
  },

  // 修改表单构建
  updateFormConstruct: async (data: FormConstructVO) => {
    return await request.put({ url: `/infra/form-construct/update`, data })
  },

  // 删除表单构建
  deleteFormConstruct: async (id: number) => {
    return await request.delete({ url: `/infra/form-construct/delete?id=` + id })
  },

  // 导出表单构建 Excel
  exportFormConstruct: async (params) => {
    return await request.download({ url: `/infra/form-construct/export-excel`, params })
  },
  // 新增表单构建
  buildConstruct: async (data: FormConstructVO) => {
    return await request.post({ url: `/infra/form-construct/build`, data })
  },

}
